-- @owner: ningyali
-- @date: 2024-12-19
-- @testpoint: HTAP行列融合特性--不支持事务中操作，合理报错

--step1:建表插入数据; expect:执行成功
@conn SingleDbUser;
drop table if exists t_htap_single_0108;
create table t_htap_single_0108(
    c1 date,
    c2 int,
    c3 char(30)
);

insert into t_htap_single_0108 select generate_series(
'2024-01-01'::timestamp, '2024-01-01'::timestamp + interval '360 days', '1 day'::interval),
generate_series(1, 99),
generate_series(1, 99)||'abc';

--step2:事务中全表转换; expect:合理报错
start transaction;
    alter table t_htap_single_0108 imcstored;
commit;

start transaction;
    alter table t_htap_single_0108 imcstored;
rollback;

begin;/
    alter table t_htap_single_0108 imcstored;
commit;

--step3:事务中部分列转换; expect:合理报错
start transaction;
    alter table t_htap_single_0108 imcstored(c1, c2);
commit;

start transaction;
    alter table t_htap_single_0108 imcstored(c1, c2);
rollback;

begin;/
    alter table t_htap_single_0108 imcstored(c1, c2);
commit;

--step4:清理环境; expect:执行成功
drop table if exists t_htap_single_0108 cascade;